import request from './http.js'; //引入http.js
const api = request
export default {

	// 以下为王之鉴的后端请
	apiTest: () => {
		return api.request('/user/test', 'GET')
	},
	taskSearchAll: (obj) => {
		return api.request('/task/taskSearchAll', 'GET', obj)
	},
	dictionaryValueSearchById: (obj) => {
		return api.request('/dictionary/dictionaryValueSearchById', 'GET', obj)
	},
	projectSearchById: (obj) => {
		return api.request('/project/projectSearchById', 'GET', obj)
	},
	changeTaskStatus: (obj) => {
		return api.request('/task/changeTaskStatus', 'GET', obj)
	},
	searchUserProfilesByTaskId: (obj) => {
		return api.request('/userTask/searchUserProfilesByTaskId', 'GET', obj)
	},
	// 以上为王之鉴的后端请求

	projectFileSearchById: (obj) => {
		return api.request()
	},
	taskSearchAllWithUser: (status) => {
		return api.request('/task/taskSearchAllByUser', 'POST', status)
	},
	getTaskStatusNum: () => {
		return api.request('/task/getStatusNum', 'POST')
	},
	getJoinTeams: () => {
		return api.request('/team/getJoinTeams', 'POST')
	},
	createTeam: (obj) => {
		return api.request('/team/create', 'POST', obj)
	},
	uploadAvatar: (path) => {
		return api.uploadAvatar('/team/savePic', path)
	},
	// 在我的资源界面列出项目下的文件
	listFiles: (obj) => {
		return api.request('/file/listFiles', 'GET', obj)
	},
	// 在我的资源界面列出项目
	listProjects: (obj) => {
		return api.request('/project/listProjects', 'GET', obj)
	},
	// 实现在我的资源界面上传文件
	uploadFile: (path) => {
		return api.uploadFile('https://example.com/file/upload', path, {
			token: uni.getStorageSync('WeTeamToken') // 可添加其他参数
		});
	},
	getAllParentTask: (projectid) => {
		return api.request('/task/getAllTasksCanBeParent', 'GET', projectid)
	},
	getAllSonTask: (projectid) => {
		return api.request('/task/getAllTasksCanBeSon', 'GET', projectid)
	},
	getAllUsers: (teamid) => {
		return api.request('/userTeam/getAllUsers', 'GET', teamid)
	},
	getTeamUsers: (teamid) => {
		return api.request('/userTeam/getTeamUsers', 'POST', teamid)
	},
	insertproject: (obj) => {
		return api.request('/project/insert', 'POST', obj)
	},
	insertTask: (task) => {
		return api.request('/task/createTask', 'POST', task)
	},
	checkTeamIfExists: (team) => {
		return api.request('/team/checkIfExists', 'POST', team)
	},
	getProjectAndItsNum: (teamId) => {
		return api.request('/project/getProjectAndItsNum', 'POST', teamId)
	},
	saveUserTaskRelationship: (list) => {
		return api.requestJson('/userTask/saveTaskUserRelationship', 'POST', list)
	},
	handleSonTasks: (mess) => {
		return api.requestJson('/task/handleSonTask', 'POST', mess)
	},
	getMessage: () => {
		return api.request("/info/getInfo", "POST");
	},
	deleteMessage: (id) => {
		return api.request("/info/deleteInfo", "GET", id);
	},
	haveReadMessage: (id) => {
		return api.request("/info/haveReadMessage", "GET", id);
	},
	sendMessage: (obj) => {
		return api.request('/info/sendMessage', 'POST', obj)
	},
	getUserId: (obj) => {
		return api.request('/user/getUserId', 'POST', obj)
	},
	getTeamById: (obj) => {
		return api.request('/team/getTeamById', 'GET', obj)
	},
	joinTeam: (obj) => {
		return api.request('/team/join', 'POST', obj)
	},
	getUserInfo: () => {
		return api.request(`/user/getUserInfo`, 'GET')
	},
	setUserInfo: (obj) => {
		return api.request('/user/setInfo', 'POST', obj)
	},
	changeProjectStatus: (obj) => {
		return api.request('/project/changeStatus', 'POST', obj)
	},
	ifCreator: (obj) => {
		return api.request('/userTeam/ifCreator', 'POST', obj)
	},
	deleteFile: (obj) => {
		return api.request('/file/deleteFiles', 'POST', obj)
	},
	getCurrentSons: (taskId) => {
		return api.request('/task/getCurrentChild', 'POST', taskId)
	},
	getTaskUsers: (taskID) => {
		return api.request("/userTask/getTaskUsers", 'POST', taskID)
	},
	removeTaskUsers: (obj) => {
		return api.requestJson('/userTask/removeUserTask', 'POST', obj)
	},
	getFilePath: (obj) => {
		return api.request('/file/getFilePath', 'GET', obj)
	},
	downloadFile: (obj) => {
		return api.request('/file/download', 'GET', obj)
	},
	renameFile: (obj) => {
		return api.request('/file/renameFile', 'POST', obj);
	},
	getPreviewUrl: (id) => {
		return api.request('/file/preview', 'POST', id);
	},
	updateTask: (task) => {
		return api.request('/task/updateTask', 'POST', task)
	},
	moveFile: (obj) => {
		return api.request('/file/moveFile', 'POST', obj)
	},
	changeCreator: (obj) => {
		return api.request('/userTeam/changeCreator', 'POST', obj)
	},
	removeTeamRelationship: (obj) => {
		return api.request('/userTeam/removeRelationship', 'POST', obj)
	},
	deleteTeam: (obj) => {
		return api.request('/team/deleteTeam', 'POST', obj)
	},
}